package tp.pr1;

public class Instruction {
	private Action action;
	private Rotation rotation;
	
	public Instruction()
	{
	 action=Action.UNKNOWN;
	 rotation=Rotation.UNKNOWN;
	}
	
	public Instruction(Action action)
	{
     this.action=action;
     rotation=Rotation.UNKNOWN;
	}
	
	public Instruction(Action action, Rotation rotation)
	{
		this.action=action;
		this.rotation=rotation;
	}
	
	public boolean isValid()
	{
		switch(this.action)
			{
				case UNKNOWN: return false;
				case HELP:return true;
				case QUIT:return true;
				case MOVE:return true; 
				case TURN:
					switch(this.rotation)
						{
							case LEFT: return true;
							case RIGHT: return true;
							case UNKNOWN: return false;
							default: return false;
						}
				default: return false;	
			}
	}
	
	public Action getAction()
	{
		return action;
	}
	
	public Rotation getRotation()
	{
		return rotation;
	}
	
}
